GHashTable *uint_values;
GHashTable *uint64_values;
+ gboolean dead;
+
char *status;
};
const char *status)
{
g_mutex_lock (&self->lock);
- g_free (self->status);
- self->status = g_strdup (status);
- ensure_callback_locked (self);
+ if (!self->dead)
+ {
+ g_free (self->status);
+ self->status = g_strdup (status);
+ ensure_callback_locked (self);
+ }
g_mutex_unlock (&self->lock);
}
g_mutex_lock (&self->lock);
+ if (self->dead)
+ goto out;
+
if (g_hash_table_lookup_extended (hash, qkey, NULL, &orig_value))
{
if (orig_value == value)
g_signal_connect (ret, "changed", G_CALLBACK (changed), user_data);
return ret;
}
+
+/**
+ * ostree_async_progress_finish:
+ * @self: Self
+ *
+ * Process any pending signals, ensuring the main context is cleared
+ * of sources used by this object. Also ensures that no further
+ * events will be queued.
+ */
+void
+ostree_async_progress_finish (OstreeAsyncProgress *self)
+{
+ gboolean emit_changed = FALSE;
+
+ g_mutex_lock (&self->lock);
+ if (!self->dead)
+ {
+ self->dead = TRUE;
+ if (self->idle_source)
+ {
+ g_source_destroy (self->idle_source);
+ self->idle_source = NULL;
+ emit_changed = TRUE;
+ }
+ }
+ g_mutex_unlock (&self->lock);
+
+ if (emit_changed)
+ g_signal_emit (self, signals[CHANGED], 0);
+}